package com.monster.security.entity;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/** 用户权限信息
 * @author kuang
 */
@Data
public class UserDetail implements UserDetails {
    /**
     * 用户名称
     */
    private String name;
    /**
     * 用户昵称
     */
    private String petName;
    /**
     * 用户名
     */
    private String userName;
    /**
     * 密码
     */
    private String password;
    /**
     * 账户是否未过期
     */
    private boolean accountNonExpired;
    /**
     * 账户是否未锁定
     */
    private boolean accountNonLocked;
    /**
     * 凭证是否未过期
     */
    private boolean credentialsNonExpired;
    /**
     * 账户是否可用
     */
    private boolean enabled;
    /**
     * 返回用户的所有角色
     */
    private Collection<? extends GrantedAuthority> authorities;

    @Override
    public String getUsername() {
        return this.userName;
    }
}
